RedCiiu = function(){
	
	return {
		guardarCiiu01 : function(){
			var form = Ext.getCmp("redCiiu01Form").getForm();
			if(!form.isValid()){
				Asg.Message.alertInvalidFields();
				return;
			}
			Asg.Message.progress("Guardando Informacion...");
			form.submit({
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/guardarCiiu01",
			    success: function(form, action) {
			    	Asg.Grid.loadData("gridCiiu01", action.result.ciiu01);
			    	Ext.Msg.hide();
			    },
			    failure: Asg.Form.failureProcedure
			});
		},
		eliminarCiiu01 : function(ciiu01Codigo){
			Ext.Ajax.request({
				timeout: Asg.constants.TIMEOUT_SECONDS,
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/eliminarCiiu01",
			    params: {
			    	ciiu01Codigo: ciiu01Codigo
			    },
			    callback: function(options, success, response){
			    	if(success){
			    		var jsonObject = Asg.Utils.ajaxRequestGetJson(response);
			    		if(jsonObject){
			    			Asg.Grid.loadData("gridCiiu01", jsonObject.ciiu01);
			    			Ext.Msg.hide();
			    		}
			    	}
			    }
			});
		},
		guardarCiiu02 : function(){
			var form = Ext.getCmp("redCiiu02Form").getForm();
			if(!form.isValid()){
				Asg.Message.alertInvalidFields();
				return;
			}
			
			Asg.Message.progress("Guardando Informacion...");
			form.submit({
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/guardarCiiu02",
			    params: {
			    	"ciiu02.ciiu01.ciiu01Codigo": Asg.Utils.getValue("ciiu0102")
			    },
			    success: function(form, action) {
			    	Asg.Grid.loadData("gridCiiu02", action.result.ciiu02);
			    	Ext.Msg.hide();
			    },
			    failure: Asg.Form.failureProcedure
			});
			
		},
		eliminarCiiu02 : function(ciiu01Codigo,ciiu02Codigo){
			Ext.Ajax.request({
				timeout: Asg.constants.TIMEOUT_SECONDS,
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/eliminarCiiu02",
			    params: {
			    	ciiu01Codigo: ciiu01Codigo,
			    	ciiu02Codigo: ciiu02Codigo
			    },
			    callback: function(options, success, response){
			    	if(success){
			    		var jsonObject = Asg.Utils.ajaxRequestGetJson(response);
			    		if(jsonObject){
			    			Asg.Grid.loadData("gridCiiu02", jsonObject.ciiu02);
			    			Ext.Msg.hide();
			    		}
			    	}
			    }
			});
		},
		guardarCiiu03 : function(){
			var form = Ext.getCmp("redCiiu03Form").getForm();
			if(!form.isValid()){
				Asg.Message.alertInvalidFields();
				return;
			}
			
			Asg.Message.progress("Guardando Informacion...");
			form.submit({
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/guardarCiiu03",
			    params: {
			    	"ciiu03.ciiu01.ciiu01Codigo": Asg.Utils.getValue("ciiu0103"),
			    	"ciiu03.ciiu02.ciiu02Codigo": Asg.Utils.getValue("ciiu0203")
			    	
			    },
			    success: function(form, action) {
			    	Asg.Grid.loadData("gridCiiu03", action.result.ciiu03);
			    	Ext.Msg.hide();
			    },
			    failure: Asg.Form.failureProcedure
			});
			
		},
		eliminarCiiu03 : function(ciiu01Codigo,ciiu02Codigo,ciiu03Codigo){
			Ext.Ajax.request({
				timeout: Asg.constants.TIMEOUT_SECONDS,
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/eliminarCiiu03",
			    params: {
			    	ciiu01Codigo: ciiu01Codigo,
			    	ciiu02Codigo: ciiu02Codigo,
			    	ciiu03Codigo: ciiu03Codigo
			    },
			    callback: function(options, success, response){
			    	if(success){
			    		var jsonObject = Asg.Utils.ajaxRequestGetJson(response);
			    		if(jsonObject){
			    			Asg.Grid.loadData("gridCiiu03", jsonObject.ciiu03);
			    			Ext.Msg.hide();
			    		}
			    	}
			    }
			});
		},
		guardarCiiu04 : function(){
			var form = Ext.getCmp("redCiiu04Form").getForm();
			if(!form.isValid()){
				Asg.Message.alertInvalidFields();
				return;
			}
			
			Asg.Message.progress("Guardando Informacion...");
			form.submit({
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/guardarCiiu04",
			    params: {
			    	"ciiu04.ciiu01.ciiu01Codigo": Asg.Utils.getValue("ciiu0104"),
			    	"ciiu04.ciiu02.ciiu02Codigo": Asg.Utils.getValue("ciiu0204"),
			    	"ciiu04.ciiu03.ciiu03Codigo": Asg.Utils.getValue("ciiu0304")
			    	
			    },
			    success: function(form, action) {
			    	Asg.Grid.loadData("gridCiiu04", action.result.ciiu04);
			    	Ext.Msg.hide();
			    },
			    failure: Asg.Form.failureProcedure
			});
			
		},
		eliminarCiiu04 : function(ciiu01Codigo,ciiu02Codigo,ciiu03Codigo,ciiu04Codigo){
			Ext.Ajax.request({
				timeout: Asg.constants.TIMEOUT_SECONDS,
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/eliminarCiiu04",
			    params: {
			    	ciiu01Codigo: ciiu01Codigo,
			    	ciiu02Codigo: ciiu02Codigo,
			    	ciiu03Codigo: ciiu03Codigo,
			    	ciiu04Codigo: ciiu04Codigo
			    },
			    callback: function(options, success, response){
			    	if(success){
			    		var jsonObject = Asg.Utils.ajaxRequestGetJson(response);
			    		if(jsonObject){
			    			Asg.Grid.loadData("gridCiiu04", jsonObject.ciiu04);
			    			Ext.Msg.hide();
			    		}
			    	}
			    }
			});
		},
		guardarActividad : function(){
			var form = Ext.getCmp("redActividadesContribuyeteForm").getForm();
			if(!form.isValid()){
				Asg.Message.alertInvalidFields();
				return;
			}
			
			Asg.Message.progress("Guardando Informacion...");
			form.submit({
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/guardarActividad",
			    params: {
			    	"actividadesRegistroContribuyente.ciiu01.ciiu01Codigo": Asg.Utils.getValue("ciiu01AC"),
			    	"actividadesRegistroContribuyente.ciiu02.ciiu02Codigo": Asg.Utils.getValue("ciiu02AC"),
			    	"actividadesRegistroContribuyente.ciiu03.ciiu03Codigo": Asg.Utils.getValue("ciiu03AC"),
			    	"actividadesRegistroContribuyente.ciiu04.ciiu04Codigo": Asg.Utils.getValue("ciiu04AC")
			    	
			    },
			    success: function(form, action) {
			    	Asg.Grid.loadData("gridActividad", action.result.actividad);
			    	Ext.Msg.hide();
			    },
			    failure: Asg.Form.failureProcedure
			});
			
		},
		eliminarActividad : function(ciiu01Codigo,ciiu02Codigo,ciiu03Codigo,ciiu04Codigo,actividadId){
			Ext.Ajax.request({
				timeout: Asg.constants.TIMEOUT_SECONDS,
			    url: Asg.constants.CONTEXT_PATH + "/ciiu/eliminarActividad",
			    params: {
			    	ciiu01Codigo: ciiu01Codigo,
			    	ciiu02Codigo: ciiu02Codigo,
			    	ciiu03Codigo: ciiu03Codigo,
			    	ciiu04Codigo: ciiu04Codigo,
			    	actividadId: actividadId
			    },
			    callback: function(options, success, response){
			    	if(success){
			    		var jsonObject = Asg.Utils.ajaxRequestGetJson(response);
			    		if(jsonObject){
			    			Asg.Grid.loadData("gridActividad", jsonObject.actividad);
			    			Ext.Msg.hide();
			    		}
			    	}
			    }
			});
		},
		initConfig: function(config){
			config = config || {};
			Ext.define("redCiiu01Model",{
				extend: "Ext.data.Model",
				fields:[
			        "ciiu01Codigo",
			        "ciiu01Nombre"
		        ]
			});
			var storeCiiu01 = Ext.create("Ext.data.Store", {
				autoLoad: true,
				model: "redCiiu01Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu01",
					reader: {
						type: "array",
						root: "ciiu01"
					}
				}
			});
			
			Ext.define("redCiiu02Model",{
				extend: "Ext.data.Model",
				fields:[
			        "ciiu01Codigo",
			        "ciiu02Codigo",
			        "ciiu02Nombre"
		        ]
			});
			
			var storeCiiu02 = Ext.create("Ext.data.Store", {
				model: "redCiiu02Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu02ByCiiu01",
					reader: {
						type: "array",
						root: "ciiu02"
					}
				}
			});
			
			var storeCiiu02Cmb  = Ext.create("Ext.data.Store", {
				model: "redCiiu02Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu02ByCiiu01",
					reader: {
						type: "array",
						root: "ciiu02"
					}
				}
			});
			
			var storeCiiu02CmbFrom04  = Ext.create("Ext.data.Store", {
				model: "redCiiu02Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu02ByCiiu01",
					reader: {
						type: "array",
						root: "ciiu02"
					}
				}
			});
			
			Ext.define("redCiiu03Model",{
				extend: "Ext.data.Model",
				fields:[
		        	"ciiu01Codigo",
		        	"ciiu02Codigo",
			        "ciiu03Codigo",
			        "ciiu03Nombre"
		        ]
			});
			
			
			var storeCiiu03 = Ext.create("Ext.data.Store", {
				model: "redCiiu03Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu03ByCiiu01AndCiiu02",
					reader: {
						type: "array",
						root: "ciiu03"
					}
				}
			});
			
			var storeCiiu03Cmb = Ext.create("Ext.data.Store", {
				model: "redCiiu03Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu03ByCiiu01AndCiiu02",
					reader: {
						type: "array",
						root: "ciiu03"
					}
				}
			});
			
			Ext.define("redCiiu04Model",{
				extend: "Ext.data.Model",
				fields:[
		        	"ciiu01Codigo",
		        	"ciiu02Codigo",
		        	"ciiu03Codigo",
			        "ciiu04Codigo",
			        "ciiu04Nombre"
		        ]
			});
			
			var storeCiiu04 = Ext.create("Ext.data.Store", {
				model: "redCiiu04Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu03ByCiiu01AndCiiu02AndCiiu03",
					reader: {
						type: "array",
						root: "ciiu04"
					}
				}
			});
			
			
			Ext.define("redActividadModel",{
				extend: "Ext.data.Model",
				fields:[
		        	"ciiu01Codigo",
		        	"ciiu02Codigo",
		        	"ciiu03Codigo",
			        "ciiu04Codigo",
			        "actividadRegistroContribuyenteId",
			        "actividadRegistroContribuyenteNombre"
		        ]
			});
			
			var storeActividad = Ext.create("Ext.data.Store", {
				model: "redActividadModel",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarActividadByCiiu01To04",
					reader: {
						type: "array",
						root: "actividad"
					}
				}
			});
			
			var storeCiiu02CmbFromActividad  = Ext.create("Ext.data.Store", {
				model: "redCiiu02Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu02ByCiiu01",
					reader: {
						type: "array",
						root: "ciiu02"
					}
				}
			});
			
			var storeCiiu03CmbFromActividad = Ext.create("Ext.data.Store", {
				model: "redCiiu03Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu03ByCiiu01AndCiiu02",
					reader: {
						type: "array",
						root: "ciiu03"
					}
				}
			});
			
			var storeCiiu04Cmb = Ext.create("Ext.data.Store", {
				model: "redCiiu04Model",
				proxy: {
					type: "ajax",
					url: Asg.constants.CONTEXT_PATH + "/ciiu/buscarCiiu03ByCiiu01AndCiiu02AndCiiu03",
					reader: {
						type: "array",
						root: "ciiu04"
					}
				}
			});
			return {
				items: [{
					xtype: "tabpanel",
		        	minHeight: 450,
		        	width: 700,
		        	margins: "50 50 50 50",
		        	frame: true,
		        	deferredRender: false,
		        	items: [{
		        		title: "CIIU 01",
        	        	margin: "10 0 0 0",
        	        	autoScroll: true,
        	        	items: {
        	        		xtype: "form",
        	        		id: "redCiiu01Form",
        	        		border: false,
        	        		height: 450,
        	        		frame: true,
        	        		layout: {
	        	        		type: "table",
								columns: 2,
								tableAttrs: {
						            style: {width: "620px"},
						            align: "center"
								}
	        	        	},
	        	        	defaults: Asg.Form.defaults({width: 305}),
	        	        	items: [
        	        	        {
    	        	        		xtype: "textfield",
    	        	        		fieldLabel: "CIIU 01 C\u00F3digo",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu01Codigo",
    	        	        		name: "ciiu01Codigo",
    	        	        		allowBlank: false,
    	        	        		width: 200,
    	        	        		maxLength: 2,
    	        	        		colspan: 2,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600
	        	        		},
	        	        		{
    	        	        		xtype: "textfield", 
    	        	        		fieldLabel: "CIIU 01 Nombre",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu01Nombre",
    	        	        		name: "ciiu01Nombre",
    	        	        		allowBlank: false,
    	        	        		maxLength: 250,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600,
    	        	        		width: 590,
    	        	        		colspan: 2,
    	        	        		flex: 1
	        	        		},{
	        	        			xtype: "grid",
	        	        			boder: false,
	        	        			id: "gridCiiu01",
	        	        			margins: "10 5 5 5",
	        	        			flex: 1,
	        	        			height: 275,
	        	        			colspan: 2,
	        	        			columWidth: 510,
	        	        			width: 600,
	        	        			store: storeCiiu01,
	        	        			columns: [
	        	        			      {
	        	        			    	  xtype:"actioncolumn",
	        	        			    	  width: 60,
	        	        			    	  items: [{
		        	        			    	  icon: Asg.constants.CONTEXT_PATH + "/resources/images/cancel.png",
		        	        			    	  tooltip: "Eliminar",
		        	        			    	  iconCls: "action_icons",
		        	        			    	  handler: function(grid, rowIndex, colIndex) {
		        	        			    		  Ext.Msg.confirm(Asg.constants.APPLICATION_TITLE, 
		        	        			    				  Asg.constants.CONFIRM_DELETE_MESSAGE, function(btn, text){
		        	        			    			  if (btn == 'yes'){
		        	        			    				  var record = grid.getStore().getAt(rowIndex);
				        	        			    		  if(record != null){
				        	        			    			  RedCiiu.eliminarCiiu01(record.get("ciiu01Codigo"));
				        	        			    		  }
		        	        			    			  }
		        	        			    		  });
		        	        			    		 
		        	        			    	  }
	        	        			    	  },{
	        	        			    		  icon: Asg.constants.CONTEXT_PATH + "/resources/images/edit.png",
	        	        			    		  tooltip: "Editar",
	        	        			    		  iconCls: "action_icons",
	        	        			    		  handler: function(grid, rowIndex, colIndex){
	        	        			    			  var record = grid.getStore().getAt(rowIndex);
	        	        			    			  if(record != null){
	        	        			    				 Ext.getCmp("redCiiu01Form").getForm().loadRecord(record); 
	        	        			    				 Ext.getCmp("btnModificar").setVisible(true);
	        	        			    				 Ext.getCmp("btnAgregar").setVisible(false);
	        	        			    			  }
	        	        			    		  }
	        	        			    	  }]
	        	        			      },
		    					          {text: "Codigo", width: 60, dataIndex: "ciiu01Codigo"},
		    					          {text: "Nombre", flex: 1, dataIndex: "ciiu01Nombre"}
        				          	],
        				          	tbar: [
        			        	       {
        			        	    	   text: "Agregar", 
        			        	    	   id: "btnAgregar",
        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
        			        	    	   handler: function(){
        			        	    		   RedCiiu.guardarCiiu01();
    			        	    		   }
        			        	       }, 
        			        	       {
        			        	    	   text: "Modificar",
        			        	    	   id: "btnModificar",
        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
        			        	    	   hidden:true,
        			        	    	   handler: function(){
        			        	    		   RedCiiu.guardarCiiu01();
    			        	    		   }
        			        	       },
        			        	       {
        			        	    	   text: "Limpiar", 
        			        	    	   handler: function(){
        			        	    		   Ext.getCmp("redCiiu01Form").getForm().reset();
        			        	    		   Ext.getCmp("btnModificar").setVisible(false);
        			        	    		   Ext.getCmp("btnAgregar").setVisible(true);
    			        	    		   }
        			        	       } 
        		        	        ]
	        	        		}
    	        	        ]
        	        	}
		        	},{
		        		title: "CIIU 02",
        	        	margin: "5 0 0 0",
        	        	autoScroll: true,
        	        	items: {
        	        		xtype: "form",
        	        		id: "redCiiu02Form",
        	        		border: false,
        	        		height: 450,
        	        		frame: true,
        	        		layout: {
	        	        		type: "table",
								columns: 2,
								tableAttrs: {
						            style: {width: "520px"},
						            align: "center"
								}
	        	        	},
	        	        	defaults: Asg.Form.defaults({width: 255}),
	        	        	items: [
	        	        	    {
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 01",
	        	        	    	id: "ciiu0102",
	        	        	    	name: "ciiu01.ciiu01Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu01,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu01Codigo",
    	    						displayField: "ciiu01Nombre",
    	    						listeners:{
    	    							change: function(f, ciiu01Codigo, o, e){
    	    								storeCiiu02.load({params: {ciiu01Codigo : ciiu01Codigo}});
    	    							}
    	    						}
	        	        	    },
        	        	        {
    	        	        		xtype: "textfield",
    	        	        		fieldLabel: "CIIU 02 C\u00F3digo",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu02Codigo",
    	        	        		name: "ciiu02Codigo",
    	        	        		allowBlank: false,
    	        	        		width: 200,
    	        	        		maxLength: 2,
    	        	        		colspan: 2,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600
	        	        		},
	        	        		{
    	        	        		xtype: "textfield", 
    	        	        		fieldLabel: "CIIU 02 Nombre",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu02Nombre",
    	        	        		name: "ciiu02Nombre",
    	        	        		allowBlank: false,
    	        	        		maxLength: 250,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600,
    	        	        		width: 590,
    	        	        		colspan: 2,
    	        	        		flex: 1
	        	        		},
	        	        		{
	        	        			xtype: "grid",
	        	        			boder: false,
	        	        			id: "gridCiiu02",
	        	        			margins: "10 5 5 5",
	        	        			flex: 1,
	        	        			height: 275,
	        	        			colspan: 2,
	        	        			columWidth: 510,
	        	        			width: 600,
	        	        			store: storeCiiu02,
	        	        			columns: [
		        	        			      {
		        	        			    	  xtype:"actioncolumn",
		        	        			    	  width: 60,
		        	        			    	  items: [{
			        	        			    	  icon: Asg.constants.CONTEXT_PATH + "/resources/images/cancel.png",
			        	        			    	  tooltip: "Eliminar",
			        	        			    	  iconCls: "action_icons",
			        	        			    	  handler: function(grid, rowIndex, colIndex) {
			        	        			    		  Ext.Msg.confirm(Asg.constants.APPLICATION_TITLE, 
			        	        			    				  Asg.constants.CONFIRM_DELETE_MESSAGE, function(btn, text){
			        	        			    			  if (btn == 'yes'){
			        	        			    				  var record = grid.getStore().getAt(rowIndex);
					        	        			    		  if(record != null){
					        	        			    			  RedCiiu.eliminarCiiu02(record.get("ciiu01Codigo"),record.get("ciiu02Codigo"));
					        	        			    		  }
			        	        			    			  }
			        	        			    		  });
			        	        			    		 
			        	        			    	  }
		        	        			    	  },{
		        	        			    		  icon: Asg.constants.CONTEXT_PATH + "/resources/images/edit.png",
		        	        			    		  tooltip: "Editar",
		        	        			    		  iconCls: "action_icons",
		        	        			    		  handler: function(grid, rowIndex, colIndex){
		        	        			    			  var record = grid.getStore().getAt(rowIndex);
		        	        			    			  if(record != null){
		        	        			    				  Ext.getCmp("redCiiu02Form").getForm().loadRecord(record);
		        	        			    			  }
		        	        			    		  }
		        	        			    	  }]
		        	        			      },
			    					          {text: "Codigo", width: 60, dataIndex: "ciiu02Codigo"},
			    					          {text: "Nombre", flex: 1, dataIndex: "ciiu02Nombre"}
	        				          	],
	        				          	tbar: [
	        			        	       {
	        			        	    	   text: "Agregar", 
	        			        	    	   id: "btnAgregar2",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu02();
	    			        	    		   }
	        			        	       }, 
	        			        	       {
	        			        	    	   text: "Modificar",
	        			        	    	   id: "btnModificar2",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   hidden:true,
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu02();
	    			        	    		   }
	        			        	       },
	        			        	       {
	        			        	    	   text: "Limpiar", 
	        			        	    	   handler: function(){
	        			        	    		   Ext.getCmp("redCiiu02Form").getForm().reset();
	        			        	    		   Ext.getCmp("btnModificar2").setVisible(false);
	        			        	    		   Ext.getCmp("btnAgregar2").setVisible(true);
	    			        	    		   }
	        			        	       } 
	        		        	        ]
	        	        		}
        	        		]
        	        	}
		        	},{
		        		title: "CIIU 03",
        	        	margin: "5 0 0 0",
        	        	autoScroll: true,
        	        	items: {
        	        		xtype: "form",
        	        		id: "redCiiu03Form",
        	        		border: false,
        	        		height: 450,
        	        		frame: true,
        	        		layout: {
	        	        		type: "table",
								columns: 2,
								tableAttrs: {
						            style: {width: "520px"},
						            align: "center"
								}
	        	        	},
	        	        	defaults: Asg.Form.defaults({width: 255}),
	        	        	items: [
	        	        	    {
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 01",
	        	        	    	id: "ciiu0103",
	        	        	    	name: "ciiu01.ciiu01Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu01,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu01Codigo",
    	    						displayField: "ciiu01Nombre",
    	    						listeners:{
    	    							change: function(f, ciiu01Codigo, o, e){
    	    								storeCiiu02Cmb.load({params: {ciiu01Codigo : ciiu01Codigo}});
    	    								
    	    							}
    	    						}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 02",
	        	        	    	id: "ciiu0203",
	        	        	    	name: "ciiu02.ciiu02Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu02Cmb,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu02Codigo",
    	    						displayField: "ciiu02Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu02Codigo, o, e){
	        	        	    			storeCiiu03.load({params: {
	        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu0103"),
	        	        	    					ciiu02Codigo: ciiu02Codigo
	        	        	    				}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
    	        	        		xtype: "textfield",
    	        	        		fieldLabel: "CIIU 03 C\u00F3digo",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu03Codigo",
    	        	        		name: "ciiu03Codigo",
    	        	        		allowBlank: false,
    	        	        		width: 200,
    	        	        		maxLength: 3,
    	        	        		colspan: 2,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600
	        	        		},
	        	        		{
    	        	        		xtype: "textfield", 
    	        	        		fieldLabel: "CIIU 03 Nombre",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu03Nombre",
    	        	        		name: "ciiu03Nombre",
    	        	        		allowBlank: false,
    	        	        		maxLength: 250,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600,
    	        	        		width: 590,
    	        	        		colspan: 2,
    	        	        		flex: 1
	        	        		},{
	        	        			xtype: "grid",
	        	        			boder: false,
	        	        			id: "gridCiiu03",
	        	        			margins: "10 5 5 5",
	        	        			flex: 1,
	        	        			height: 275,
	        	        			colspan: 2,
	        	        			columWidth: 510,
	        	        			width: 600,
	        	        			store: storeCiiu03,
	        	        			columns: [
	        	        			      {
	        	        			    	  xtype:"actioncolumn",
	        	        			    	  width: 60,
	        	        			    	  items: [{
		        	        			    	  icon: Asg.constants.CONTEXT_PATH + "/resources/images/cancel.png",
		        	        			    	  tooltip: "Eliminar",
		        	        			    	  iconCls: "action_icons",
		        	        			    	  handler: function(grid, rowIndex, colIndex) {
		        	        			    		  Ext.Msg.confirm(Asg.constants.APPLICATION_TITLE, 
		        	        			    				  Asg.constants.CONFIRM_DELETE_MESSAGE, function(btn, text){
		        	        			    			  if (btn == 'yes'){
		        	        			    				  var record = grid.getStore().getAt(rowIndex);
				        	        			    		  if(record != null){
				        	        			    			  RedCiiu.eliminarCiiu03(
				        	        			    					  record.get("ciiu01Codigo"),
				        	        			    					  record.get("ciiu02Codigo"),
				        	        			    					  record.get("ciiu03Codigo"));
				        	        			    		  }
		        	        			    			  }
		        	        			    		  });
		        	        			    		 
		        	        			    	  }
	        	        			    	  },{
	        	        			    		  icon: Asg.constants.CONTEXT_PATH + "/resources/images/edit.png",
	        	        			    		  tooltip: "Editar",
	        	        			    		  iconCls: "action_icons",
	        	        			    		  handler: function(grid, rowIndex, colIndex){
	        	        			    			  var record = grid.getStore().getAt(rowIndex);
	        	        			    			  if(record != null){
	        	        			    				  Ext.getCmp("redCiiu03Form").getForm().loadRecord(record);
	        	        			    			  }
	        	        			    		  }
	        	        			    	  }]
	        	        			      },
		    					          {text: "Codigo", width: 60, dataIndex: "ciiu03Codigo"},
		    					          {text: "Nombre", flex: 1, dataIndex: "ciiu03Nombre"}
	        				          	],
	        				          	tbar: [
	        			        	       {
	        			        	    	   text: "Agregar", 
	        			        	    	   id: "btnAgregar3",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu03();
	    			        	    		   }
	        			        	       }, 
	        			        	       {
	        			        	    	   text: "Modificar",
	        			        	    	   id: "btnModificar3",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   hidden:true,
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu03();
	    			        	    		   }
	        			        	       },
	        			        	       {
	        			        	    	   text: "Limpiar", 
	        			        	    	   handler: function(){
	        			        	    		   Ext.getCmp("redCiiu03Form").getForm().reset();
	        			        	    		   Ext.getCmp("btnModificar3").setVisible(false);
	        			        	    		   Ext.getCmp("btnAgregar3").setVisible(true);
	    			        	    		   }
	        			        	       } 
	        		        	        ]
	        	        		}
        	        	    ]
        	        	}
		        	},{
		        		title: "CIIU 04",
        	        	margin: "5 0 0 0",
        	        	autoScroll: true,
        	        	items: {
        	        		xtype: "form",
        	        		id: "redCiiu04Form",
        	        		border: false,
        	        		height: 450,
        	        		frame: true,
        	        		layout: {
	        	        		type: "table",
								columns: 2,
								tableAttrs: {
						            style: {width: "520px"},
						            align: "center"
								}
	        	        	},
	        	        	defaults: Asg.Form.defaults({width: 255}),
	        	        	items: [
	        	        	    {
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 01",
	        	        	    	id: "ciiu0104",
	        	        	    	name: "ciiu01.ciiu01Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu01,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu01Codigo",
    	    						displayField: "ciiu01Nombre",
    	    						listeners:{
    	    							change: function(f, ciiu01Codigo, o, e){
    	    								storeCiiu02CmbFrom04.load({params: {ciiu01Codigo : ciiu01Codigo}});
    	    							}
    	    						}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 02",
	        	        	    	id: "ciiu0204",
	        	        	    	name: "ciiu02.ciiu02Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu02CmbFrom04,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu02Codigo",
    	    						displayField: "ciiu02Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu02Codigo, o, e){
	        	        	    			storeCiiu03Cmb.load({params: {
        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu0104"),
        	        	    					ciiu02Codigo: ciiu02Codigo
	        	        	    				}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 03",
	        	        	    	id: "ciiu0304",
	        	        	    	name: "ciiu03.ciiu03Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu03Cmb,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu03Codigo",
    	    						displayField: "ciiu03Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu03Codigo, o, e){
	        	        	    			storeCiiu04.load({params: {
	        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu0104"),
	        	        	    					ciiu02Codigo: Asg.Utils.getValue("ciiu0204"),
	        	        	    					ciiu03Codigo: ciiu03Codigo
        	        	    					}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
    	        	        		xtype: "textfield",
    	        	        		fieldLabel: "CIIU 04 C\u00F3digo",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu04Codigo",
    	        	        		name: "ciiu04Codigo",
    	        	        		allowBlank: false,
    	        	        		width: 200,
    	        	        		maxLength: 4,
    	        	        		colspan: 2,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600
	        	        		},
	        	        		{
    	        	        		xtype: "textfield", 
    	        	        		fieldLabel: "CIIU 04 Nombre",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "ciiu04Nombre",
    	        	        		name: "ciiu04Nombre",
    	        	        		allowBlank: false,
    	        	        		maxLength: 250,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600,
    	        	        		width: 590,
    	        	        		colspan: 2,
    	        	        		flex: 1
	        	        		},{
	        	        			xtype: "grid",
	        	        			boder: false,
	        	        			id: "gridCiiu04",
	        	        			margins: "10 5 5 5",
	        	        			flex: 1,
	        	        			height: 275,
	        	        			colspan: 2,
	        	        			columWidth: 510,
	        	        			width: 600,
	        	        			store: storeCiiu04,
	        	        			columns: [
	        	        			      {
	        	        			    	  xtype:"actioncolumn",
	        	        			    	  width: 60,
	        	        			    	  items: [{
		        	        			    	  icon: Asg.constants.CONTEXT_PATH + "/resources/images/cancel.png",
		        	        			    	  tooltip: "Eliminar",
		        	        			    	  iconCls: "action_icons",
		        	        			    	  handler: function(grid, rowIndex, colIndex) {
		        	        			    		  Ext.Msg.confirm(Asg.constants.APPLICATION_TITLE, 
		        	        			    				  Asg.constants.CONFIRM_DELETE_MESSAGE, function(btn, text){
		        	        			    			  if (btn == 'yes'){
		        	        			    				  var record = grid.getStore().getAt(rowIndex);
				        	        			    		  if(record != null){
				        	        			    			  RedCiiu.eliminarCiiu04(
				        	        			    					  record.get("ciiu01Codigo"),
				        	        			    					  record.get("ciiu02Codigo"),
				        	        			    					  record.get("ciiu03Codigo"),
				        	        			    					  record.get("ciiu04Codigo"));
				        	        			    		  }
		        	        			    			  }
		        	        			    		  });
		        	        			    		 
		        	        			    	  }
	        	        			    	  },{
	        	        			    		  icon: Asg.constants.CONTEXT_PATH + "/resources/images/edit.png",
	        	        			    		  tooltip: "Editar",
	        	        			    		  iconCls: "action_icons",
	        	        			    		  handler: function(grid, rowIndex, colIndex){
	        	        			    			  var record = grid.getStore().getAt(rowIndex);
	        	        			    			  if(record != null){
	        	        			    				  Ext.getCmp("redCiiu04Form").getForm().loadRecord(record);
	        	        			    			  }
	        	        			    		  }
	        	        			    	  }]
	        	        			      },
		    					          {text: "Codigo", width: 60, dataIndex: "ciiu04Codigo"},
		    					          {text: "Nombre", flex: 1, dataIndex: "ciiu04Nombre"}
	        				          	],
	        				          	tbar: [
	        			        	       {
	        			        	    	   text: "Agregar", 
	        			        	    	   id: "btnAgregar4",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu04();
	    			        	    		   }
	        			        	       }, 
	        			        	       {
	        			        	    	   text: "Modificar",
	        			        	    	   id: "btnModificar4",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   hidden:true,
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarCiiu04();
	    			        	    		   }
	        			        	       },
	        			        	       {
	        			        	    	   text: "Limpiar", 
	        			        	    	   handler: function(){
	        			        	    		   Ext.getCmp("redCiiu04Form").getForm().reset();
	        			        	    		   Ext.getCmp("btnModificar4").setVisible(false);
	        			        	    		   Ext.getCmp("btnAgregar4").setVisible(true);
	    			        	    		   }
	        			        	       } 
	        		        	        ]
	        	        		}
        	        		]
        	        	}
		        	},{
		        		title: "ACTIVIDADES DE REGISTRO DEL CONTRIBUYENTE",
        	        	margin: "5 0 0 0",
        	        	autoScroll: true,
        	        	items: {
        	        		xtype: "form",
        	        		id: "redActividadesContribuyeteForm",
        	        		border: false,
        	        		height: 450,
        	        		frame: true,
        	        		layout: {
	        	        		type: "table",
								columns: 2,
								tableAttrs: {
						            style: {width: "520px"},
						            align: "center"
								}
	        	        	},
	        	        	defaults: Asg.Form.defaults({width: 255}),
	        	        	items: [
        	        	        {
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 01",
	        	        	    	id: "ciiu01AC",
	        	        	    	name: "ciiu01.ciiu01Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu01,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu01Codigo",
    	    						displayField: "ciiu01Nombre",
    	    						listeners:{
    	    							change: function(f, ciiu01Codigo, o, e){
    	    								storeCiiu02CmbFromActividad.load({params: {ciiu01Codigo : ciiu01Codigo}});
    	    							}
    	    						}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 02",
	        	        	    	id: "ciiu02AC",
	        	        	    	name: "ciiu02.ciiu02Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu02CmbFromActividad,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu02Codigo",
    	    						displayField: "ciiu02Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu02Codigo, o, e){
	        	        	    			storeCiiu03CmbFromActividad.load({
	        	        	    				params: {
	        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu01AC"),
	        	        	    					ciiu02Codigo : ciiu02Codigo
	        	        	    				}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 03",
	        	        	    	id: "ciiu03AC",
	        	        	    	name: "ciiu03.ciiu03Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu03CmbFromActividad,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu03Codigo",
    	    						displayField: "ciiu03Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu03Codigo, o, e){
	        	        	    			storeCiiu04Cmb.load({params: {
	        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu01AC"),
	        	        	    					ciiu02Codigo: Asg.Utils.getValue("ciiu02AC"),
	        	        	    					ciiu03Codigo: ciiu03Codigo
	        	        	    				}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
	        	        	    	xtype: "combobox",
	        	        	    	fieldLabel: "CIIU 04",
	        	        	    	id: "ciiu04AC",
	        	        	    	name: "ciiu04.ciiu04Codigo",
	        	        	    	labelWidth: 125,
	        	        	    	allowBlank: false,
	        	        	    	labelStyle: Asg.constants.LABEL_STYLE_TEXT,
	        	        	    	colspan: 2,
	        	        	    	width: 590,
	        	        	    	store: storeCiiu04Cmb,
    	        	        		columnWidth: 600,
    	        	        		valueField: "ciiu04Codigo",
    	    						displayField: "ciiu04Nombre",
    	    						listeners: {
	        	        	    		change: function(f, ciiu04Codigo, o, e){
	        	        	    			storeActividad.load({params: {
	        	        	    					ciiu01Codigo : Asg.Utils.getValue("ciiu01AC"),
	        	        	    					ciiu02Codigo: Asg.Utils.getValue("ciiu02AC"),
	        	        	    					ciiu03Codigo: Asg.Utils.getValue("ciiu03AC"),
	        	        	    					ciiu04Codigo: ciiu04Codigo
        	        	    					}
	        	        	    			});
	        	        	    		}
	        	        	    	}
	        	        	    },{
    	        	        		xtype: "textfield", 
    	        	        		fieldLabel: "Nombre Actividad",
    	        	        		labelStyle: Asg.constants.LABEL_STYLE_TEXT,
    	        	        		id: "actividadRegistroContribuyenteNombre",
    	        	        		name: "actividadRegistroContribuyenteNombre",
    	        	        		allowBlank: false,
    	        	        		maxLength: 250,
    	        	        		labelWidth: 125,
    	        	        		columnWidth: 600,
    	        	        		width: 590,
    	        	        		colspan: 2,
    	        	        		flex: 1
	        	        		},{
	        	        	    	xtype: "hidden",
	        	        	    	id: "actividadRegistroContribuyenteId",
    	        	        		name: "actividadRegistroContribuyenteId",
    	        	        		colspan: 2
	        	        	    },{
	        	        			xtype: "grid",
	        	        			boder: false,
	        	        			id: "gridActividad",
	        	        			margins: "10 5 5 5",
	        	        			flex: 1,
	        	        			height: 275,
	        	        			colspan: 2,
	        	        			columWidth: 510,
	        	        			width: 600,
	        	        			store: storeActividad,
	        	        			columns: [
	        	        			      {
	        	        			    	  xtype:"actioncolumn",
	        	        			    	  width: 60,
	        	        			    	  items: [{
		        	        			    	  icon: Asg.constants.CONTEXT_PATH + "/resources/images/cancel.png",
		        	        			    	  tooltip: "Eliminar",
		        	        			    	  iconCls: "action_icons",
		        	        			    	  handler: function(grid, rowIndex, colIndex) {
		        	        			    		  Ext.Msg.confirm(Asg.constants.APPLICATION_TITLE, 
		        	        			    				  Asg.constants.CONFIRM_DELETE_MESSAGE, function(btn, text){
		        	        			    			  if (btn == 'yes'){
		        	        			    				  var record = grid.getStore().getAt(rowIndex);
				        	        			    		  if(record != null){
				        	        			    			  RedCiiu.eliminarActividad(
				        	        			    					  record.get("ciiu01Codigo"),
				        	        			    					  record.get("ciiu02Codigo"),
				        	        			    					  record.get("ciiu03Codigo"),
				        	        			    					  record.get("ciiu04Codigo"),
				        	        			    					  record.get("actividadRegistroContribuyenteId"));
				        	        			    		  }
		        	        			    			  }
		        	        			    		  });
		        	        			    		 
		        	        			    	  }
	        	        			    	  },{
	        	        			    		  icon: Asg.constants.CONTEXT_PATH + "/resources/images/edit.png",
	        	        			    		  tooltip: "Editar",
	        	        			    		  iconCls: "action_icons",
	        	        			    		  handler: function(grid, rowIndex, colIndex){
	        	        			    			  var record = grid.getStore().getAt(rowIndex);
	        	        			    			  if(record != null){
	        	        			    				  Ext.getCmp("redActividadesContribuyeteForm").getForm().loadRecord(record);
	        	        			    			  }
	        	        			    		  }
	        	        			    	  }]
	        	        			      },
		    					          {text: "Codigo", width: 60, dataIndex: "actividadRegistroContribuyenteId"},
		    					          {text: "Nombre", flex: 1, dataIndex: "actividadRegistroContribuyenteNombre"}
	        				          	],
	        				          	tbar: [
	        			        	       {
	        			        	    	   text: "Agregar", 
	        			        	    	   id: "btnAgregar5",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarActividad();
	    			        	    		   }
	        			        	       }, 
	        			        	       {
	        			        	    	   text: "Modificar",
	        			        	    	   id: "btnModificar5",
	        			        	    	   iconCls: Asg.constants.SAVE_ICON, 
	        			        	    	   hidden:true,
	        			        	    	   handler: function(){
	        			        	    		   RedCiiu.guardarActividad();
	    			        	    		   }
	        			        	       },
	        			        	       {
	        			        	    	   text: "Limpiar", 
	        			        	    	   handler: function(){
	        			        	    		   Ext.getCmp("redActividadesContribuyeteForm").getForm().reset();
	        			        	    		   Ext.getCmp("btnModificar5").setVisible(false);
	        			        	    		   Ext.getCmp("btnAgregar5").setVisible(true);
	    			        	    		   }
	        			        	       } 
	        		        	        ]
	        	        		}
    	        	        ]
        	        	}
		        	}]
				}]
			};
		}
	};
}();
